home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Format / asn / f_teletex.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  2.0 KB  |  113 lines

  1. /* f_teletex.c: teletex Encoder/Decoder Function Routines */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Format/asn/RCS/f_teletex.c,v 6.0 1991/12/18 20:15:43 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Format/asn/RCS/f_teletex.c,v 6.0 1991/12/18 20:15:43 jpo Rel $
  9.  *
  10.  * $Log: f_teletex.c,v $
  11.  * Revision 6.0  1991/12/18  20:15:43  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "head.h"
  19. #include "IOB-types.h"
  20. #include "asn.h"
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. /* ------------------------  Start Routines --------------------------------- */
  28.  
  29.  
  30.  
  31.  
  32. decode_teletex(body)
  33. ASNBODY        **body;
  34. {
  35.     PE    pe;
  36.     int    retval;
  37.     struct type_IOB_TeletexData    *asndata;
  38.  
  39.     PP_TRACE (("decode_teletex()"));    
  40.  
  41.     pe = asn_rd_stdin (IGNORE_PRMS);
  42.  
  43.     retval = decode_IOB_TeletexData (pe, 1, NULLIP, NULLVP, &asndata);
  44.  
  45.     if (retval == NOTOK)
  46.         pe_done (pe);
  47.  
  48.     pe_free (pe);
  49.  
  50.     /* -- set ASNBODY -- */
  51.     struct2body (asndata, body);
  52.  
  53.     free_IOB_TeletexData (asndata);
  54. }
  55.  
  56.  
  57.  
  58.  
  59. encode_teletex(ppe, body)
  60. PE    *ppe;
  61. ASNBODY    *body;
  62. {
  63.     int    retval = NOTOK;
  64.     PE    pe;
  65.     struct type_IOB_TeletexBodyPart    *info = NULL;
  66.  
  67.     PP_TRACE (("encode_teletex()"));    
  68.  
  69.     /* -- set the Data structure -- */
  70.     set_teletex_data (&info, body);
  71.  
  72.     retval = encode_IOB_TeletexBodyPart (&pe, 1, NULLIP, NULLVP, info);
  73.     if (retval == NOTOK)
  74.         pe_done (ppe);    /* -- exit -- */
  75.  
  76.     pe -> pe_class = PE_CLASS_CONT;
  77.     pe -> pe_id    = 5;
  78.     *ppe = pe;
  79.  
  80.     free_IOB_TeletexBodyPart (info);
  81.     return OK;
  82. }
  83.  
  84.  
  85.  
  86.  
  87. /* -----------------------  Static  Routines  ------------------------------- */
  88.  
  89.  
  90.  
  91.  
  92. static set_teletex_data (dstruct, body)
  93. struct type_IOB_TeletexBodyPart    **dstruct;
  94. ASNBODY        *body;
  95. {
  96.     struct type_IOB_TeletexBodyPart    *tbptr;
  97.  
  98.  
  99.     PP_TRACE (("set_teletex_data()"));
  100.  
  101.     /* -- malloc main structure -- */
  102.     tbptr = (struct type_IOB_TeletexBodyPart *)
  103.         smalloc (sizeof *tbptr);
  104.     bzero (tbptr, sizeof *tbptr);
  105.  
  106.     tbptr -> parameters = (struct type_IOB_TeletexParameters *)
  107.         smalloc (sizeof *tbptr -> parameters);
  108.     bzero (tbptr -> parameters, sizeof *tbptr -> parameters);
  109.  
  110.     body2struct (body, &tbptr -> data);
  111.     *dstruct = tbptr;
  112. }
  113.